class Solution {
public:
    vector<int> getRow(int rowIndex) {
        vector<int> arr(rowIndex + 2, 0);
        vector<int> ans;
        arr[1] = 1;
        for(int i = 1; i <= rowIndex; ++i)
        {
            for(int j = i + 1; j >= 1; --j)
            {
                arr[j] = arr[j - 1] + arr[j];
            }
        }
        for(int i = 1; i <= rowIndex + 1; ++i)
            ans.push_back(arr[i]);
        if(ans.empty()) ans.push_back(1);
        return ans;
    }
};
